home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / Resources.h < prev    next >
C/C++ Source or Header  |  1995-07-06  |  9KB  |  262 lines

  1. /*
  2.      File:        Resources.h
  3.  
  4.      Contains:    Resource Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __RESOURCES__
  21. #define __RESOURCES__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __MIXEDMODE__
  30. #include <MixedMode.h>
  31. #endif
  32.  
  33. #ifndef __FILES__
  34. #include <Files.h>
  35. #endif
  36. /*    #include <OSUtils.h>                                        */
  37. /*        #include <Memory.h>                                        */
  38. /*    #include <Finder.h>                                            */
  39.  
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43.  
  44. #if PRAGMA_ALIGN_SUPPORTED
  45. #pragma options align=mac68k
  46. #endif
  47.  
  48. #if PRAGMA_IMPORT_SUPPORTED
  49. #pragma import on
  50. #endif
  51.  
  52.  
  53. enum {
  54.     resSysHeap                    = 64,                            /*System or application heap?*/
  55.     resPurgeable                = 32,                            /*Purgeable resource?*/
  56.     resLocked                    = 16,                            /*Load it in locked?*/
  57.     resProtected                = 8,                            /*Protected?*/
  58.     resPreload                    = 4,                            /*Load in on OpenResFile?*/
  59.     resChanged                    = 2,                            /*Resource changed?*/
  60.     mapReadOnly                    = 128,                            /*Resource file read-only*/
  61.     mapCompact                    = 64,                            /*Compact resource file*/
  62.     mapChanged                    = 32,                            /*Write map out at update*/
  63.     resSysRefBit                = 7,                            /*reference to system/local reference*/
  64.     resSysHeapBit                = 6,                            /*In system/in application heap*/
  65.     resPurgeableBit                = 5,                            /*Purgeable/not purgeable*/
  66.     resLockedBit                = 4,                            /*Locked/not locked*/
  67.     resProtectedBit                = 3,                            /*Protected/not protected*/
  68.     resPreloadBit                = 2,                            /*Read in at OpenResource?*/
  69.     resChangedBit                = 1,                            /*Existing resource changed since last update*/
  70.     mapReadOnlyBit                = 7,                            /*is this file read-only?*/
  71.     mapCompactBit                = 6,                            /*Is a compact necessary?*/
  72.     mapChangedBit                = 5,                            /*Is it necessary to write map?*/
  73.     kResFileNotOpened            = -1,                            /*ref num return as error when opening a resource file*/
  74.     kSystemResFile                = 0                                /*this is the default ref num to the system file*/
  75. };
  76.  
  77. /*
  78.         ResErrProcPtr uses register based parameters on the 68k and cannot
  79.         be written in or called from a high-level language without the help of
  80.         mixed mode or assembly glue.
  81.  
  82.             typedef pascal void (*ResErrProcPtr)(OSErr thErr);
  83.  
  84.         In:
  85.          => thErr           D0.W
  86. */
  87.  
  88. #if GENERATINGCFM
  89. typedef UniversalProcPtr ResErrUPP;
  90. #else
  91. typedef Register68kProcPtr ResErrUPP;
  92. #endif
  93.  
  94. enum {
  95.     uppResErrProcInfo = kRegisterBased
  96.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterD0, SIZE_CODE(sizeof(OSErr)))
  97. };
  98.  
  99. #if GENERATINGCFM
  100. #define NewResErrProc(userRoutine)        \
  101.         (ResErrUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppResErrProcInfo, GetCurrentArchitecture())
  102. #else
  103. #define NewResErrProc(userRoutine)        \
  104.         ((ResErrUPP) (userRoutine))
  105. #endif
  106.  
  107. #if GENERATINGCFM
  108. #define CallResErrProc(userRoutine, thErr)        \
  109.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppResErrProcInfo, (thErr))
  110. #else
  111. /* (*ResErrProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  112. #endif
  113.  
  114. extern pascal short InitResources(void)
  115.  ONEWORDINLINE(0xA995);
  116. extern pascal void RsrcZoneInit(void)
  117.  ONEWORDINLINE(0xA996);
  118. extern pascal void CloseResFile(short refNum)
  119.  ONEWORDINLINE(0xA99A);
  120. extern pascal short ResError(void)
  121.  ONEWORDINLINE(0xA9AF);
  122. extern pascal short CurResFile(void)
  123.  ONEWORDINLINE(0xA994);
  124. extern pascal short HomeResFile(Handle theResource)
  125.  ONEWORDINLINE(0xA9A4);
  126. extern pascal void CreateResFile(ConstStr255Param fileName)
  127.  ONEWORDINLINE(0xA9B1);
  128. extern pascal short OpenResFile(ConstStr255Param fileName)
  129.  ONEWORDINLINE(0xA997);
  130. extern pascal void UseResFile(short refNum)
  131.  ONEWORDINLINE(0xA998);
  132. extern pascal short CountTypes(void)
  133.  ONEWORDINLINE(0xA99E);
  134. extern pascal short Count1Types(void)
  135.  ONEWORDINLINE(0xA81C);
  136. extern pascal void GetIndType(ResType *theType, short index)
  137.  ONEWORDINLINE(0xA99F);
  138. extern pascal void Get1IndType(ResType *theType, short index)
  139.  ONEWORDINLINE(0xA80F);
  140. extern pascal void SetResLoad(Boolean load)
  141.  ONEWORDINLINE(0xA99B);
  142. extern pascal short CountResources(ResType theType)
  143.  ONEWORDINLINE(0xA99C);
  144. extern pascal short Count1Resources(ResType theType)
  145.  ONEWORDINLINE(0xA80D);
  146. extern pascal Handle GetIndResource(ResType theType, short index)
  147.  ONEWORDINLINE(0xA99D);
  148. extern pascal Handle Get1IndResource(ResType theType, short index)
  149.  ONEWORDINLINE(0xA80E);
  150. extern pascal Handle GetResource(ResType theType, short theID)
  151.  ONEWORDINLINE(0xA9A0);
  152. extern pascal Handle Get1Resource(ResType theType, short theID)
  153.  ONEWORDINLINE(0xA81F);
  154. extern pascal Handle GetNamedResource(ResType theType, ConstStr255Param name)
  155.  ONEWORDINLINE(0xA9A1);
  156. extern pascal Handle Get1NamedResource(ResType theType, ConstStr255Param name)
  157.  ONEWORDINLINE(0xA820);
  158. extern pascal void LoadResource(Handle theResource)
  159.  ONEWORDINLINE(0xA9A2);
  160. extern pascal void ReleaseResource(Handle theResource)
  161.  ONEWORDINLINE(0xA9A3);
  162. extern pascal void DetachResource(Handle theResource)
  163.  ONEWORDINLINE(0xA992);
  164. extern pascal short UniqueID(ResType theType)
  165.  ONEWORDINLINE(0xA9C1);
  166. extern pascal short Unique1ID(ResType theType)
  167.  ONEWORDINLINE(0xA810);
  168. extern pascal short GetResAttrs(Handle theResource)
  169.  ONEWORDINLINE(0xA9A6);
  170. extern pascal void GetResInfo(Handle theResource, short *theID, ResType *theType, Str255 name)
  171.  ONEWORDINLINE(0xA9A8);
  172. extern pascal void SetResInfo(Handle theResource, short theID, ConstStr255Param name)
  173.  ONEWORDINLINE(0xA9A9);
  174. extern pascal void AddResource(Handle theData, ResType theType, short theID, ConstStr255Param name)
  175.  ONEWORDINLINE(0xA9AB);
  176. extern pascal long GetResourceSizeOnDisk(Handle theResource)
  177.  ONEWORDINLINE(0xA9A5);
  178. extern pascal long GetMaxResourceSize(Handle theResource)
  179.  ONEWORDINLINE(0xA821);
  180. extern pascal long RsrcMapEntry(Handle theResource)
  181.  ONEWORDINLINE(0xA9C5);
  182. extern pascal void SetResAttrs(Handle theResource, short attrs)
  183.  ONEWORDINLINE(0xA9A7);
  184. extern pascal void ChangedResource(Handle theResource)
  185.  ONEWORDINLINE(0xA9AA);
  186. extern pascal void RemoveResource(Handle theResource)
  187.  ONEWORDINLINE(0xA9AD);
  188. extern pascal void UpdateResFile(short refNum)
  189.  ONEWORDINLINE(0xA999);
  190. extern pascal void WriteResource(Handle theResource)
  191.  ONEWORDINLINE(0xA9B0);
  192. extern pascal void SetResPurge(Boolean install)
  193.  ONEWORDINLINE(0xA993);
  194. extern pascal short GetResFileAttrs(short refNum)
  195.  ONEWORDINLINE(0xA9F6);
  196. extern pascal void SetResFileAttrs(short refNum, short attrs)
  197.  ONEWORDINLINE(0xA9F7);
  198. extern pascal short OpenRFPerm(ConstStr255Param fileName, short vRefNum, SInt8 permission)
  199.  ONEWORDINLINE(0xA9C4);
  200. extern pascal Handle RGetResource(ResType theType, short theID)
  201.  ONEWORDINLINE(0xA80C);
  202. #if SystemSevenOrLater
  203. extern pascal short HOpenResFile(short vRefNum, long dirID, ConstStr255Param fileName, SInt8 permission)
  204.  ONEWORDINLINE(0xA81A);
  205. #else
  206. extern pascal short HOpenResFile(short vRefNum, long dirID, ConstStr255Param fileName, SInt8 permission);
  207. #endif
  208. #if SystemSevenOrLater
  209. extern pascal void HCreateResFile(short vRefNum, long dirID, ConstStr255Param fileName)
  210.  ONEWORDINLINE(0xA81B);
  211. #else
  212. extern pascal void HCreateResFile(short vRefNum, long dirID, ConstStr255Param fileName);
  213. #endif
  214. extern pascal short FSpOpenResFile(const FSSpec *spec, SignedByte permission)
  215.  TWOWORDINLINE(0x700D, 0xAA52);
  216. extern pascal void FSpCreateResFile(const FSSpec *spec, OSType creator, OSType fileType, ScriptCode scriptTag)
  217.  TWOWORDINLINE(0x700E, 0xAA52);
  218. /*  partial resource calls  */
  219. extern pascal void ReadPartialResource(Handle theResource, long offset, void *buffer, long count)
  220.  TWOWORDINLINE(0x7001, 0xA822);
  221. extern pascal void WritePartialResource(Handle theResource, long offset, const void *buffer, long count)
  222.  TWOWORDINLINE(0x7002, 0xA822);
  223. extern pascal void SetResourceSize(Handle theResource, long newSize)
  224.  TWOWORDINLINE(0x7003, 0xA822);
  225. extern pascal Handle GetNextFOND(Handle fondHandle)
  226.  TWOWORDINLINE(0x700A, 0xA822);
  227. /* Use TempInsertROMMap to force the ROM resource map to be
  228.    inserted into the chain in front of the system. Note that
  229.    this call is only temporary - the modified resource chain
  230.    is only used for the next call to the resource manager.
  231.    See IM IV 19 for more information. */
  232. extern pascal void TempInsertROMMap(Boolean tempResLoad);
  233. #if CGLUESUPPORTED
  234. extern Handle getnamedresource(ResType theType, const char *name);
  235. extern Handle get1namedresource(ResType theType, const char *name);
  236. extern short openrfperm(const char *fileName, short vRefNum, char permission);
  237. extern short openresfile(const char *fileName);
  238. extern void createresfile(const char *fileName);
  239. extern void getresinfo(Handle theResource, short *theID, ResType *theType, char *name);
  240. extern void setresinfo(Handle theResource, short theID, const char *name);
  241. extern void addresource(Handle theResource, ResType theType, short theID, const char *name);
  242. #endif
  243. #if OLDROUTINENAMES
  244. #define SizeResource(theResource) GetResourceSizeOnDisk(theResource)
  245. #define MaxSizeRsrc(theResource) GetMaxResourceSize(theResource)
  246. #define RmveResource(theResource) RemoveResource(theResource)
  247. #endif
  248.  
  249. #if PRAGMA_IMPORT_SUPPORTED
  250. #pragma import off
  251. #endif
  252.  
  253. #if PRAGMA_ALIGN_SUPPORTED
  254. #pragma options align=reset
  255. #endif
  256.  
  257. #ifdef __cplusplus
  258. }
  259. #endif
  260.  
  261. #endif /* __RESOURCES__ */
  262.